package com.lifang.imsoa.util;

import lombok.Getter;
import lombok.Setter;



public class EntityUtils {
	public static String convertDecorateType(int type) {
		switch (type) {
		case 1:
			return "毛坯";
		case 2:
			return "装修";
		case 3:
			return "普装";
		case 4:
			return "精装";
		case 5:
			return "豪装";
		default:
			return "";
		}
	}

	/**
	 * 房屋楼层类型：返回 低层，中层，高层
	 * 
	 * @param floor
	 * @return
	 */
	public static String convertFloorType(int floor) {
		if (floor < 7) {
			return "低层";
		} else if (floor >= 7 && floor <= 12) {
			return "中层";
		} else {
			return "高层";
		}
	}
	
	/**
	 * ACTION类型 1,发布; 4,轮询; 
	 */
	public enum ActionTypeEnum {
		UNKNOW(0, "未知"),

		PUBLISH(1, "发布"),

		LOOP(4, "客服轮询");


		private int value;
		private String desc;

		private ActionTypeEnum(int value, String desc) {
			this.value = value;
			this.desc = desc;
		}

		public static ActionTypeEnum getByValue(int value) {
			for (ActionTypeEnum ve : values()) {
				if (NumberUtils.isEqual(value, ve.value)) {
					return ve;
				}
			}
			return UNKNOW;
		}

		public int getValue() {
			return value;
		}

		public void setValue(int value) {
			this.value = value;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}

	}
	
	/**
	 * 房屋出售状态 ，2出售， 4即不租也不售
	 */
	public enum HouseStateEnum {

		UNKNOW(0, "未知"),
		
		RENT(1, "出租"),

		SELL(2, "出售"),

		NEITHER(4, "不售");

		private int value;
		private String desc;

		private HouseStateEnum(int value, String desc) {
			this.value = value;
			this.desc = desc;
		}

		public static HouseStateEnum getByValue(int value) {
			for (HouseStateEnum sse : values()) {
				if (NumberUtils.isEqual(value, sse.value)) {
					return sse;
				}
			}
			return UNKNOW;
		}

		public int getValue() {
			return value;
		}

		public void setValue(int value) {
			this.value = value;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
	}
	
	
	/**
	 * 房子的照片
	 * 
	 * @author tom 图片类型：
	 *  1, 首图
	 *  3, 卧室
	 *  2, 客厅
	 *  4, 厨房 
	 *  6, 阳台
	 *  5, 卫生间
	 *  7, 房型图 
	 *  8, 外观图
	 */
	
	public enum HouseImageType {
		UNKNOW(0, "未知", "未知"),

		FIRSTPIC(1, "firstPic", "首图"),
		BEDROOM(3, "bedRoom", "卧室"),
		
		LIVINGROOM(2, "livingRoom", "客厅"),
		
		KITCHEN(4,  "kitchen", "厨房"),
		BALCONY(6, "balcony", "阳台"),
		
		WC(5, "wc", "卫生间"),
		
		HOUSETYPE(7, "houseType", "房型图"),
		EXTERIOR(8, "exterior", "外观图");
        

        private int value;
		private String type;
		private String desc;

		private HouseImageType(int value, String type, String desc) {
			this.value = value;
			this.type = type;
			this.desc = desc;
		}

		public static HouseImageType getByValue(int value) {
			for (HouseImageType re : values()) {
				if (NumberUtils.isEqual(value, re.value)) {
					return re;
				}
			}
			return UNKNOW;
		}
		
		public int getValue() {
			return value;
		}

		public void setValue(int value) {
			this.value = value;
		}

		public String getType() {
			return type;
		}

		public void setType(String type) {
			this.type = type;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		
	}

	
	/**
     * 审核状态 1,审核成功;2,审核中;3,审核失败;4,无效; 5,上传中
     * 
     * 
     */
    public enum CheckStateEnum {

        UNUSED(0, "-"),

        /**
         * 1.审核成功
         */
        SUCCESS(1, "审核成功"),

        /**
         * 2.审核中
         */
        ING(2, "审核中"),

        /**
         * 3.审核失败
         */
        FAILD(3, "审核失败"),

        DISABLED(4, "无效"),
        
        uploading(5, "上传中");

        private int value;
        private String desc;

        private CheckStateEnum(int value, String desc) {
            this.value = value;
            this.desc = desc;
        }

        public static CheckStateEnum getByValue(int value) {
            for (CheckStateEnum ve : values()) {
                if (NumberUtils.isEqual(value, ve.value)) {
                    return ve;
                }
            }
            return UNUSED;
        }

        public int getValue() {
            return value;
        }

        public void setValue(int value) {
            this.value = value;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
	
	public enum LimitNumEnum {
		
		/**
		 * 到手价：不大于10,000,000,000（100亿）；
		 */
		GOT_PRICE(10000000000L, "最大到手价"),

		/**
		 * 租    金：不大于10,000,000（1000万）；
		 */
		RENT_PRICE(10000000L, "最大租金"),
		
		/**
		 * 面    积：不大于10,000平方米；
		 */
		SPACE_AREA(10000L, "最大租金");

		@Getter @Setter
		private Long value;
		@Getter @Setter
		private String desc;

		private LimitNumEnum(Long value, String desc) {
			this.value = value;
			this.desc = desc;
		}

	}
	/**
	 * 
	 * 朝向的枚举类
	 *
	 * @author   Andy
	 * @Date	 2015年4月9日		下午5:06:28
	 *
	 * @see
	 */
	public enum OrientationEnum{
		UNKNOW(0,"UNKNOW","未知"),
		EAST(1,"EAST","东"),
		SOUT(2,"SOUT","南"),
		WEST(3,"WEST","西"),
		NORTH(4,"NORTH","北"),
		XINAN(5,"XINAN","西南"),
		DONGNAN(6,"DONGNAN","东南"),
		DONGBEI(7,"DONGBEI","东北"),
		XIBEI(8,"XIBEI","西北"),
		NANBEI(9,"NANBEI","南北"),
		DONGXI(10,"DONGXI","东西");
		
		@Getter @Setter
		private int ID;
		
		@Getter @Setter
		private String DIRECTION_EN;//英文
		
		@Getter @Setter
		private String DIRECTION_ZH;//中文
		
		private OrientationEnum(int id,String direction_en,String direction_zh){
			this.ID = id;
			this.DIRECTION_EN = direction_en;
			this.DIRECTION_ZH = direction_zh;
		}
		
		public static OrientationEnum getByID(int id) {
			for (OrientationEnum re : values()) {
				if (re.getID() == id){
					return re;
				}
			}
			return UNKNOW;
		}

	}
	//andy 注释，该枚举由CheckFaildTypeEnum替代 2015-05-07
//	  public enum FailReasonEnum {
//			
//			/**
//			 * 房源无效原因：未知；
//			 */
//	    	 UNKONW(0, "未知"),
//
//			/**
//			 * 房源无效原因：暂缓；
//			 */
//	    	 SUSPEND(1, "暂缓"),
//			
//			/**
//			 * 房源无效原因：我租；
//			 */
//			MY_RENT(2, "我租"),
//	    	 
//	    	 /**
//	 		 * 房源无效原因：已租；
//	 		 */
//	 		ALREADY_RENT(3, "已租"),
//	 		
//	 		/**
//			 * 房源无效原因：已售；
//			 */
//	 		ALREADY_SELL(4, "已售");
//		
//
//			@Getter @Setter
//			private int value;
//			@Getter @Setter
//			private String desc;
//
//			private FailReasonEnum(int value, String desc) {
//				this.value = value;
//				this.desc = desc;
//			}
//
//			public static FailReasonEnum getByValue(int value) {
//				for (FailReasonEnum re : values()) {
//					if (re.getValue() == value){
//						return re;
//					}
//				}
//				return UNKONW;
//			}
//		}
	/**
	 * 审核失败 类型 
	 * 
	 * 1. 不符合要求（租金低于6000/租期超1月/办公楼/商铺/合租/群租/租售搞错）
	 * 2. 中介号码
	 * 3. 已租/不租
	 * 4. 已售/不售
	 * 5. 房源信息错误，小区名错误
	 * 6. 房源信息错误，楼号错误
	 * 7. 房源信息错误，室号错误
	 * 8. 停机/空号/错号
	 * 9. 无法联系/无人接听/无法接通/关机/来电提醒/再联系/不配合       ###第一至第五轮无该选项###
	 * @author administrator
	 *
	 */
	public enum CheckFaildTypeEnum{
		UNUSED(0, "--"),
		DISCREPANCY(1,"未知"),
		AGENT(2,"暂缓"),
		NO_RENT(3,"我租"),
		NO_SELL(4,"已租"),
		ESTATE_ERROR(5,"已售");
//		BUILDING_ERROR(6,"房源信息错误，楼号错误"),
//		ROOM_ERROR(7,"房源信息错误，室号错误"),
//		COLSED(8,"停机/空号/错号"),
//		CANNOT_CONNECT(9, "无法联系/无人接听/无法接通/关机/来电提醒/再联系/不配合");
		
		private int value;
		private String desc;
		
		private CheckFaildTypeEnum(int value , String desc){
			this.value = value;
			this.desc = desc;
		}
		public static CheckFaildTypeEnum getByValue(int value) {
			for (CheckFaildTypeEnum ve : values()) {
				if (NumberUtils.isEqual(value, ve.value)) {
					return ve;
				}
			}
			return UNUSED;
		}
		public int getValue() {
			return value;
		}
		public void setValue(int value) {
			this.value = value;
		}
		public String getDesc() {
			return desc;
		}
		public void setDesc(String desc) {
			this.desc = desc;
		}
	}

	  /**
	   * 消息推送类型
	   *
	   * @author   周智明
	   * @Date	 2015年4月14日	下午3:46:07
	   *
	   * @see
	   */
	public enum PushThemeEnum {

		UNUSED(0, "-"),
		HOUSE_LIST(1, "房源列表"),
		HOUSE_RELEASE(2, "我的房源-已发布"),
		HOUSE_CHECK(3, "我的房源-审核中"),
		PASS_SOURCE(4, "客源");

		@Getter @Setter
		private int value;
		@Getter @Setter
		private String desc;

		private PushThemeEnum(int value, String desc) {
			this.value = value;
			this.desc = desc;
		}
	}
	/**
	 * 价格类型
	 * @author fangyouhui
	 *
	 */
	public enum PriceTypeEnum {

		UNUSED(0, "未知"),
		DAOSHAOJIA(1, "到手价"),
		GEFUJIA(2, "各付价");

		@Getter @Setter
		private int value;
		@Getter @Setter
		private String desc;

		private PriceTypeEnum(int value, String desc) {
			this.value = value;
			this.desc = desc;
		}
	}
	
	
	public enum ObjectEnum {

		TOWN(0, "town"),
		ESTATE(1, "estate"),
		SUBESTATE(2, "subEstate"),
		BUILDING(3,"building");
		@Getter @Setter
		private int value;
		@Getter @Setter
		private String desc;

		private ObjectEnum(int value, String desc) {
			this.value = value;
			this.desc = desc;
		}
	}
	
	public enum DataSourceEnum {
		UNUSED(0, "未知"),
		JRSP(1, "今日笋盘"),
		YFYK(2, "有房有客");
		@Getter @Setter
		private int value;
		@Getter @Setter
		private String desc;
		private DataSourceEnum(int value, String desc) {
			this.value = value;
			this.desc = desc;
		}
	}
	
	public enum DicItudeEnum {
		UNUSED(0, "0"),
		COUNTYR(1, "1"),
		PROVINCE(2, "2"),
		CITY(3, "3	"),
		DISTRICT(4,"4"),
		TOWN(5,"5"),
		ESTATE(6,"6"),
		BUILDING(7,"7");
		@Getter @Setter
		private int value;
		@Getter @Setter
		private String desc;
		private DicItudeEnum(int value, String desc) {
			this.value = value;
			this.desc = desc;
		}
	}

	public  enum VideoTypeEnmu{
		onlySuccess(1,"onlySuccess"),
		EXISTSFailed(2,"EXISTSFailed");
		@Getter @Setter
		private int value;
		@Getter @Setter
		private String desc;
		private VideoTypeEnmu(int value, String desc) {
			this.value = value;
			this.desc = desc;
		}
	}

	public  enum DBTypeEnum{
		DBSlave(1,"DBSlave"),
		DBMASTER(2,"DBMASTER");
		@Getter @Setter
		private int value;
		@Getter @Setter
		private String desc;
		private DBTypeEnum(int value, String desc) {
			this.value = value;
			this.desc = desc;
		}
	}
}
